﻿Imports NMock2
 
Imports Microsoft.VisualStudio.TestTools.UnitTesting
 
Imports Meiners.Libs.Withings.Core

'''<summary>
'''This is a test class for HTTPConnectorTest and is intended
'''to contain all HTTPConnectorTest Unit Tests
'''</summary>
<TestClass()> _
Public Class HTTPConnectorTest

    Private testContextInstance As TestContext

    '''<summary>
    '''Gets or sets the test context which provides
    '''information about and functionality for the current test run.
    '''</summary>
    Public Property TestContext() As TestContext
        Get
            Return testContextInstance
        End Get
        Set(ByVal value As TestContext)
            testContextInstance = Value
        End Set
    End Property

    '''<summary>
    '''A test for GetURL
    '''</summary>
    <TestMethod()> _
    Public Sub GetWebserviceResponseTest()
        Dim target As IHttpConnector = New HttpConnector
        Dim address As String = "http://wbsapi.withings.net/once?action=probe"
        Dim expected As String = My.Resources.probe_SampleResult
        Dim actual As String

        If My.Computer.Network.IsAvailable AndAlso My.Computer.Network.Ping("wbsapi.withings.net") Then
            actual = target.GetWebserviceResponse(address)
            Assert.AreEqual(Of String)(expected, actual)
        End If
    End Sub

    '''<summary>
    '''A test for HTTPConnector Constructor
    '''</summary>
    <TestMethod()> _
    Public Sub HTTPConnectorConstructorTest()
        Dim target As HTTPConnector = New HTTPConnector
        Assert.IsInstanceOfType(target, GetType(HTTPConnector))
    End Sub

End Class
